

// 1.定义导出一个选择本地文件资源的api函数
export const chooseImgApi = () => { 
    return new Promise((resolve, reject) => {
        uni.chooseImage({
            count: 5, //默认9
            sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图，默认二者都有
            sourceType: ['album','camera'], //从相册选择
            success:res=>resolve(res),
            fail: err => reject(err)
        });
    })
}

// 2.定义导出实现文件资源上传后端服务器方法
export const fileUploadApi = (url: string, name: string, filePath: string) => { 
    return new Promise((resolve, reject) => {
        uni.uploadFile({
            url,
            name,
            filePath,
            success: res => resolve(res),
            fail:err=>reject(err)
        })
    })
}